<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 处理数据的数组方法：filter  非变异方法
        var arr = [10, 20, 30, 40];
        var arr1 = arr.filter((item) => {
            return item > 10;
        });
        console.log(arr);   // [10, 20, 30, 40]
        console.log(arr1);  // [20, 30, 40]


        var teachers = ['pink老师', '乔峰', '刘德华', '张学友'];
        var newTeachers = teachers.filter((item) => {
            return item !== 'pink老师'
        })
        console.log(newTeachers);  // ["乔峰", "刘德华", "张学友"]
        console.log(teachers);   // ["pink老师", "乔峰", "刘德华", "张学友"]
    </script>
</body>

</html>